package spring;

import org.springframework.expression.Expression;
import org.springframework.expression.spel.standard.SpelExpressionParser;

import java.util.Optional;

/**
 * @program: algorithm
 * @description:
 * @author: 陈恩涛
 * @create: 2021-09-26 14:09
 **/
public class Interpreter {
    public static void main(String[] args) {
        SpelExpressionParser parser = new SpelExpressionParser();
        Expression expression = parser.parseExpression("100 * (2 + 400) * 1 + 66");
        Object result = Optional.ofNullable(expression.getValue()).orElseThrow();
        System.out.println(Integer.parseInt(String.valueOf(result)));
    }
}
